package cn.hicard.auth.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import cn.hicard.auth.dao.BaseDao;
import cn.hicard.auth.dao.RoleinfoDao;
import cn.hicard.auth.entity.MgRoleinfo;

/**
 * 角色信息管理DAO接口实现
 * @author zhangy
 *
 */
@Repository
public class RoleinfoDaoImpl  extends BaseDao<MgRoleinfo> implements RoleinfoDao{
	@Override
	public void save(MgRoleinfo role)throws Exception{
		super.save(role);
	}
	@Override
	public void update(MgRoleinfo role)throws Exception{
		super.update(role);
	}
	@Override
	public void delete(int pkRole)throws Exception{
		super.delete(pkRole);
	}
	@Override
	public MgRoleinfo getByPk(int pkRole)throws Exception{
		return super.getByPk(pkRole);
	}
	@Override
	public List<MgRoleinfo> getAll()throws Exception{
		return super.getAll();
	}
	@Override
	public List<MgRoleinfo> getByUser(int pkUserinfo) throws Exception {
		String hql = "SELECT r FROM MgRoleinfo r,MgUserRole ur WHERE r.pkRoleinfo=ur.id.pkRoleinfo AND ur.id.pkUserinfo=?";
		return super.findByHql(hql, pkUserinfo);
	}
}
